package LECONGHAU.OOP.EXCERCISE01.BAI2;

import java.util.Scanner;

public class CONTROLLER {
	String c;
	double kq ;
	String a,b;
	double soa,sob;
	public void nhap(){
	do{
		System.out.println("nhap vao gia tri cua a");
		Scanner sc=new Scanner(System.in);
		a=sc.nextLine();
		
	if(a.isEmpty()){
		System.out.println("chua nhap a! nhap lai nha");
	}
	}while(a.isEmpty());
	 soa=Double.parseDouble(a);
	do{
		System.out.println("nhap vao gia tri cua b");
		Scanner sc=new Scanner(System.in);
		b=sc.nextLine();
		if(b.isEmpty()){
			System.out.println("chua nhap b! nhap lai nha");
		}
	}while(b.isEmpty());
	 sob=Double.parseDouble(b);
	
		System.out.println("chon phep tinh + hoac - hoac * hoac /");
		Scanner sc=new Scanner(System.in);
		c=sc.nextLine();
}
	public double  CalculatorControllers(){
		

		switch (c) {
		case "+": kq=soa+sob;
		
       break;
		case "-": 
			kq=soa-sob;
		
        break;
		case "*":
			kq=(soa*sob);
		break;
		case "/":
			if(sob==0){
              
			}else {
				kq=(soa/sob);
			
			}
			
		break;
		default:
			break;
		}
		return kq;
	}
}